﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Library.Common;
using Library.Bll;

namespace HanhuaMicroCredit.BLL
{
    public static class IbddBLL
    {
        private const string _TableName = "Sys_IBDD";
        private const string _TableFields = "Id,name Name,ClassID ParentId,IsValid";
        private const string _TableKey = "Id";

        /// <summary>
        /// 
        /// </summary>
        /// <param name="isValid">状态</param>
        /// <returns></returns>
        public static List<Dictionary<string, object>> GetList(int classId, bool? isValid)
        {
            List<ConditionInfo> conditions = new List<ConditionInfo>() { 
                new ConditionInfo("ClassID", CompareType.Equals, classId.ToString())
            };
            if (isValid.HasValue)
            {
                conditions.Add(new ConditionInfo("isValid", CompareType.Equals, isValid.Value));
            }

            return CommonBLL.GetList(_TableName, _TableFields, _TableKey, conditions);
        }

        public static Dictionary<string, object> GetModel(int id)
        {
            return CommonBLL.GetModel(_TableName, _TableFields, id);
        }
    }
}
